''''''''''''''''''''''''''''''''''''
' tasktool.vbs@b4dboy 
''''''''''''''''''''''''''''''''''''

On Error Resume Next
Dim obj, pross, pid, killName
pid = WScript.Arguments(1)
killName = WScript.Arguments(0)
 
Set obj = GetObject("Winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set pross = obj.Execquery("Select * From Win32_Process")
Wscript.echo "[PID]" & VbTab & "[ProName]"
 
For Each proccess In pross
    If (WScript.Arguments.Count = 2) And (CStr(pid) = CStr(proccess.ProcessID)) Then
        proccess.Terminate 0
    ElseIf Ucase(proccess.Name) = Ucase(killName) Then
        proccess.Terminate 0
    Else
        WScript.echo proccess.ProcessID & VbTab & proccess.Name
    End If
Next
